import java.io.IOException;  
  
import javax.servlet.RequestDispatcher;  
import javax.servlet.ServletException;  
import javax.servlet.http.HttpServletRequest;  
import javax.servlet.http.HttpServletResponse;  
  
import faculdade.base.AcessoDados;  
import faculdade.base.Pessoa;  
  
/** 
* Servlet implementation class for Servlet: LoginUsuario 
* 
*/  
public class LoginUsuario extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {  
    /* (non-Java-doc) 
     * @see javax.servlet.http.HttpServlet#HttpServlet() 
     */  
    public LoginUsuario() {  
        super();  
    }         
      
    /* (non-Java-doc) 
     * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) 
     */  
    protected void doGet(HttpServletRequest request , HttpServletResponse response ) throws ServletException, IOException {  
          
          
          
            response.setContentType("aplication/jsp");    
              
         String usuarioForm = request.getParameter("login");  
            String senhaForm = request.getParameter("senha");  
            //buscar a pessoa no BD  
            Pessoa p = AcessoDados.loginUsu(usuarioForm, senhaForm);  
              
            System.out.println("passou aki");  
          
            //armazenando o objeto pessoa a ser exibido   
            request.setAttribute("pessoa", p);  
  
            //chama o JSP para exibir o objeto  
            RequestDispatcher disp;  
            disp = request.getRequestDispatcher("logado.jsp");  
            disp.forward(request, response);                                  
  
          
          
    }     
      
    /* (non-Java-doc) 
     * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) 
     */  
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
        // TODO Auto-generated method stub  
    }                 
} 